<template>
  <div>
    <van-nav-bar
      title="品牌详情"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="box">
      <img :src="brand.list_pic_url" alt="">
      <h3>{{brand.name}}</h3>
    </div>
    <div class="desc">{{brand.simple_desc}}</div>

    <Products :goodsList="goodsList"></Products>

  </div>
</template>

<script>
import {getDetail, getPinPaiList} from '@/request/api.js'
import Products  from '@/components/Products.vue'
export default {
  name: 'PinPaiZhiZao',
  props:['brandList'],
  components:{
    Products
  },
  data(){
    return{
      brand:[],
      goodsList:[]
    }
  },
  async created(){
    const id = this.$route.query.id;
    const res = await getDetail({id})
      if(res.errno==0){
        this.brand = res.data.brand
      }
    const res2 = await getPinPaiList({
      brandId:id,
      page:1,
      size:100
    })
    if(res2.errno==0){
        this.goodsList = res2.data.goodsList
      }
  },
  methods:{
    onClickLeft(){
      this.$router.go(-1)
    }
  }
}
</script>

<style  lang="less" scoped>
.box{
  position: relative;
  img{
    width: 100%;
  }
  h3{
    font-size: .20rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    text-decoration: underline;
  }
}
.desc{
  padding: .2rem;
  text-align: center;
  line-height: 1.5;
  font-size: .16rem;
  background-color: #fff;
}
</style>